//
//  EnyerViewController.m
//  ZAKER
//
//  Created by dllo on 15/8/31.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "EnyerViewController.h"

@interface EnyerViewController ()<UIWebViewDelegate>

@property (nonatomic, retain) MBProgressHUD * mb;

@end


@implementation EnyerViewController

-(void)dealloc
{
    [_mb release];
    [_urlStr release];
    
    [super dealloc];
    
}

- (void)viewDidLoad
{
    
    [super viewDidLoad];
    
    
    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    _mb = [[MBProgressHUD alloc] initWithView:window];
    [window addSubview:_mb];
    _mb.labelText = @"正在加载";
    [_mb show:YES];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(8 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        if (_mb != nil) {
            
            [_mb removeFromSuperview];
            
        }
    });
    
    [self createWebView];
    
}


//- (void)left:(UIBarButtonItem *)left
//{
//    [self.navigationController popToRootViewControllerAnimated:YES];
//}



#pragma mark - 传值网址

-(void)sendWithUrl:(NSString *)urlStr
{
    self.urlStr = urlStr;
}

-(void)createWebView
{
    
    UIWebView *web = [[[UIWebView  alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 49 * myHeight)] autorelease];
    web.delegate = self;
    NSURL *url = [NSURL URLWithString:self.urlStr];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:url];
    web.scalesPageToFit = YES;
    [web loadRequest:request];
    [self.view addSubview:web];
    
}


-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    
    [_mb hide:YES];
    _mb = nil;
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}


@end
